package com.sztest.jayjun.utils;

import android.util.Log;

import com.sztest.jayjun.MyApplication;

import java.io.File;
import java.util.HashMap;
import java.util.List;

public class PaUtils {
    public static HashMap<Integer, Integer> getPa(){
        HashMap<Integer,Integer> mHashMap=new HashMap<>();
        File file=new File(MyApplication.getInstance().getExternalFilesDir(null),"pa.txt");
        LogUtils.e("file path="+file.getPath());
        if (file.exists()){
            List<String> data = FileIOUtils.readFile2List(file);
            for (String str : data) {
                String[] split = str.split(",");
                int key=pareInt(split[0]);
                int value=pareInt(split[1]);
                mHashMap.put(key,value);
                Log.i("sys",key+"=sys="+value);
            }
        }
        return mHashMap;
    }

    public static int pareInt(String str){
        try {
          return  Integer.parseInt(str);
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }
}
